#include <stdio.h>

// 定义学生结构体
typedef struct student
{
  // 学号 姓名 成绩
  int id;
  char name[20];
  int score;
}student;

int main()
{
  // 初始化
  student students[] = {
    {1,"a",89},
    {2,"b",88},
    {3,"c",99},
    {4,"d",91},
    {5,"e",78},
    {6,"f",60},
    {7,"g",89},
    {8,"h",92},
    {9,"i",79},
    {10,"j",80}
  };

  // 总学生数
  int totalStu = sizeof(students) / sizeof(students[0]);
  // 总分数
  int totalSco = 0;
  
  int i = 0;
  for (i = 0; i < totalStu; i++)
  {
    totalSco += students[i].score;
  }

  // 平均分数
  double avg = (double)totalSco/totalStu;
  
  for(i = 0; i < totalStu; i++)
    printf("%d,%s,%d\n",students[i].id, students[i].name, students[i].score);

  printf("平均分:%.2f\n",avg);
  return 0;
}
